//
//  Category.m
//  Contacts
//
//  Created by 武 娇 on 14-8-2.
//  Copyright (c) 2014年 李 雷川. All rights reserved.
//

#import "NoticeCategory.h"
#import "NoticeCategoryDao.h"
@implementation NoticeCategory
@synthesize ID,name,newsCount,sort,ico,imageIco;

+(NoticeCategory*)analysisNoticeCategoryWithDic:(NSDictionary *)dic{
    NoticeCategory *category =[[NoticeCategory alloc]init];
    category.ID = [dic[@"id"]integerValue];
    category.name = dic[@"name"];
    category.ico = dic[@"ico"];
    category.newsCount = [dic[@"newsCount"]integerValue];
    category.sort = [dic[@"soft"]integerValue];
    category.imageIco = dic[@"imgIco"];
    return category;
}
+(NSArray *)getCategorys{
    NoticeCategoryDao *dao = [[NoticeCategoryDao alloc]init];
    NSArray *categorys =[dao getAllCategory];
    return categorys;
}
+(NoticeCategory *)getCategoryWithID:(NSInteger )categoryID{
    NoticeCategoryDao *dao = [[NoticeCategoryDao alloc]init];
    NoticeCategory *categroy =[dao getCategoryWithID:categoryID];
    return categroy;
}
+(BOOL)saveWithCategorys:(NSArray *)categorys{
    NoticeCategoryDao *dao = [[NoticeCategoryDao alloc]init];
    BOOL success =[dao saveWithCategorys:categorys];
    return success;
}
@end
